home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
- //
- // NAME: wiz-ALEs.js (Javascript file for wiz-ALEs.HTM)
- //
- // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
- //
- ////////////////////////////////////////////////////////////////////////////////////////////
-
- IE4 = document.all;
- var g_LocationAwarenessOffText;
- var g_iLocationList = null;
- var g_sProductIcon = "res://NisRes.dll/105";
- var g_sProductVersion = "8.0";
- var g_RLevelStatus = null;
- ///////////////////////////////////////////////////////
- /////////new alert params /////////////////////////////
- ///////////////////////////////////////////////////////
- //icon:
- // 0 = no icon
- // 1 = error
- // 2 = question
- // 3 = alert
- // 4 = info
- //
- //buts:
- // 0 = ok
- // 1 = ok, cancel
- // 2 = abort, retry, cancel
- // 3 = yes, no, cancel
- // 4 = yes, no
- // 5 = retry, cancel
- //
- //defbut
- // 0 = first
- // 1 = second
- // 2 = third
- //
- //mods:
- // 0 = app modal
- // 1 = system modal
- function newAlert(mess, title, icon, buts, defbut, mods)
- {
- if(IE4)
- makeMsgBox(title, mess, icon, buts, defbut, mods)
- else
- alert(mess);
- }
-
- function OnLoad()
- {
- g_RLevelStatus = new ActiveXObject("RLevel.NISStatusInfo");
-
- var iFirewallSettings = new ActiveXObject("ccFWSettg.FirewallSettings");
- g_iLocationList = iFirewallSettings.Locations;
- g_LocationAwarenessOffText = LocationAwarenessIsOffText.innerText;
-
- // Set the property bag before calling into ACDisp
- SetFWPropertyBag();
-
- FoundList.SetOnCheckedChangedCallback(foundList_OnCheckStateChanged);
-
- FoundList.UseALEList = true;
-
- FoundList.RefreshRules();
-
- FoundList.UseRegistry = false;
-
- // Now pass in a location object.
- var g_iLocation = g_iLocationList.GetDefaultItem();
-
- FoundList.FilterByLocation = g_iLocation;
- }
-
- function SetFWPropertyBag()
- {
- // Create property bag object to pass to FWUI.
- try
- {
- var fwUIPropertyBag = new ActiveXObject("fwUI.VarBstrCol");
-
- // Retrive the product name and current user type.
- var sProductName = UserManager.ProductName;
- var sCurrentUserType = UserManager.CurrentUserType;
-
-
- // Retrieve product type and help path.
- var sProductType = UserManager.ProductType;
- var sHelpPath = UserManager.HelpPath;
-
- if(sProductType == "PT_SCF")
- {
- g_iProductType = FWUI_PRODUCT_SCF;
- sHelpPath = sHelpPath + "\\SCF.chm";
- }
- else
- {
- g_iProductType = FWUI_PRODUCT_NIS;
- sHelpPath = sHelpPath + "\\SymHelp.chm";
- }
-
- // Fill in the FW property bag.
-
- // Fill in product name.
- fwUIPropertyBag.Add(ProductDisplayName);
- fwUIPropertyBag(ProductDisplayName) = sProductName;
-
- // Fill in product type.
- fwUIPropertyBag.Add(ProductType);
- fwUIPropertyBag(ProductType) = g_iProductType;
-
- // Fill in product version.
- fwUIPropertyBag.Add(ProductVersion);
- fwUIPropertyBag(ProductVersion) = g_sProductVersion;
-
- // Fill in path to product icon.
- fwUIPropertyBag.Add(ProductIconPath);
- fwUIPropertyBag(ProductIconPath) = g_sProductIcon;
-
- // Fill in path to help file.
- fwUIPropertyBag.Add(ProductHelpPath);
- fwUIPropertyBag(ProductHelpPath) = sHelpPath;
-
- // Fill in the Context ID for the FW help.
- fwUIPropertyBag.Add(RulesHelpID);
- fwUIPropertyBag(RulesHelpID) = RuleSummary;
-
- fwUIPropertyBag.Add(RuleEditActionHelpID);
- fwUIPropertyBag(RuleEditActionHelpID) = RuleEditAction;
-
- fwUIPropertyBag.Add(RuleEditIPHelpID);
- fwUIPropertyBag(RuleEditIPHelpID) = RuleEditIP;
-
- fwUIPropertyBag.Add(RuleEditDirectionHelpID);
- fwUIPropertyBag(RuleEditDirectionHelpID) = RuleEditDirection;
-
- fwUIPropertyBag.Add(RuleEditPortsHelpID);
- fwUIPropertyBag(RuleEditPortsHelpID) = RuleEditPorts;
-
- fwUIPropertyBag.Add(RuleEditLocationsHelpID);
- fwUIPropertyBag(RuleEditLocationsHelpID) = RuleEditLocations;
-
- fwUIPropertyBag.Add(RuleEditLoggingHelpID);
- fwUIPropertyBag(RuleEditLoggingHelpID) = RuleEditLogging;
-
- fwUIPropertyBag.Add(RuleEditTitleHelpID);
- fwUIPropertyBag(RuleEditTitleHelpID) = RuleEditTitle;
-
- fwUIPropertyBag.Add(AdaptersHelpID);
- fwUIPropertyBag(AdaptersHelpID) = Adapters;
-
- fwUIPropertyBag.Add(ICMPHelpID);
- fwUIPropertyBag(ICMPHelpID) = ICMP;
-
- fwUIPropertyBag.Add(SpecifyComputerHelpID);
- fwUIPropertyBag(SpecifyComputerHelpID) = IPPopup;
-
- fwUIPropertyBag.Add(IPExclusionHelpID);
- fwUIPropertyBag(IPExclusionHelpID) = IPExclusions;
-
- fwUIPropertyBag.Add(SignatureHelpID);
- fwUIPropertyBag(SignatureHelpID) = SignatureExclusions;
-
- // Fill in CurrentUserType
- fwUIPropertyBag.Add(CurrentUserType);
- fwUIPropertyBag(CurrentUserType) = sCurrentUserType;
-
- // Fill in whether Parental Control is install or not.
- fwUIPropertyBag.Add(ParentalControl);
-
- if (g_RLevelStatus.AreAccountsInstalled)
- fwUIPropertyBag(ParentalControl) = true;
- else
- fwUIPropertyBag(ParentalControl) = false;
-
- // Fill in whether Admin Rule feature is enable or not.
- fwUIPropertyBag.Add(AdminRule);
- fwUIPropertyBag(AdminRule) = UserManager.ProductFeature(4);
-
- //This should be the first thing that we do before calling into ACDisp.
- FoundList.Init(fwUIPropertyBag);
- }
- catch(e)
- {
- }
- }
-
- function driveList_OnSpace(nRow)
- {
- //
- // Swap the state of the check box for this item
- //
- var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
- CheckBox.checked = !CheckBox.checked;
- }
-
- function initDriveList()
- {
- driveList.OnSpace = driveList_OnSpace;
- driveList.DeleteAllRows();
- driveList.SetColumnCount(2);
- driveList.SetColumnWidth(0, "50px");
- driveList.SetColumnWidth(1, "83px");
-
- var szDrives = NetScan.DriveList;
-
- for(var i = 0; i < szDrives.length; ++i)
- {
- var pRow = driveList.InsertRow(-1);
- driveList.SetCellTextPtr(pRow, 0, "<input type=\"checkbox\" checked>");
- driveList.SetCellTextPtr(pRow, 1, szDrives.substring(i, i+1) + ":\\");
- }
-
- driveList.SetOnClickHandler(CheckBox_OnClick);
- }
-
- function CheckBox_OnClick()
- {
- // Get a count of checked items... if zero are checked, disable the next btn
- var nCount = driveList.GetRowCount();
-
- var nChecked = 0;
- for(var nRow = 0; nRow < nCount; ++nRow)
- {
- var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
- if(CheckBox.checked)
- {
- nChecked++;
- }
- }
-
- if(nChecked == 0)
- NextBtn.disabled = true;
- else
- NextBtn.disabled = false;
- }
-
- function saveDriveList()
- {
- var nCount = driveList.GetRowCount();
-
- szDrives = "";
- for(var nRow = 0; nRow < nCount; ++nRow)
- {
- var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
- if(CheckBox.checked)
- {
- szDrives += driveList.GetCellPtr(nRow, 1).innerText.substring(0, 1);
- }
- }
-
- NetScan.DriveList = szDrives;
- }
-
- function NextBtn_OnClick()
- {
- // Find the active page, back to front (if we are not disabled)
- if(PageD.style.display == "")
- {
- ConfigInfo.AleScanRun = true;
- returnValue = "";
- AleWiz_Body.style.cursor = "wait";
- BackBtn.disabled = true;
- FinishBtn.disabled = true;
- Cancel.disabled = true;
- locationSelectAll.disabled = true;
- locationSelectNone.disabled = true;
- locationList.Enabled(false);
- locationList.LTable.style.cursor = "wait";
- EnableCloseButton(false);
-
- // save the items in the list
- var iLocationList = UILocation_GetSelectedLocations();
- FoundList.AddALEScanLocation(iLocationList);
- FoundList.MergeItemsAsync(OnMergeItemsComplete);
- }
-
- if(PageC.style.display == "")
- {
- PageC.style.display = "none";
- PageD.style.display = "";
-
- //set location awareness text
- var bLAIsOn = g_RLevelStatus.LocationAwarenessEnabled;
- if(bLAIsOn)
- LocationAwarenessIsOffText.innerText = " ";
- else
- LocationAwarenessIsOffText.innerText = g_LocationAwarenessOffText;
- initLocationList();
-
- FixBtnText(true);
- window.focus();
- }
-
- if(PageB.style.display == "")
- {
- // setup PageC
- PageB.style.display = "none";
- PageC.style.display = "";
- NextBtn.disabled = true;
-
- window.focus();
-
- // update the foundlist after it's had a chance to be created
- window.setTimeout("UpdateFoundList()",1);
- }
-
- if(PageA.style.display == "")
- {
- PageA.style.display = "none";
- PageB.style.display = "";
-
- // setup PageB
- NextBtn.disabled = true;
- Cancel.disabled = true;
- StopBtn.disabled = false;
- EnableCloseButton(false);
-
- ScanDone.style.display = "none";
- ScanStopped.style.display = "none"
- Scanning.style.display = "";
- Filename.style.display = "";
- ScanFound.innerHTML = "0";
- SetProgress(0);
- pctdone.innerHTML = "0";
- pctdone_text.style.display = "";
-
- saveDriveList();
- g_bScanStarted = true;
- NetScan.StartScan(FoundList);
-
- FixBtnText(false);
- }
- }
-
- function UpdateFoundList()
- {
- FoundList.RefreshALEList();
- FoundList_OnSelect();
- }
-
- function OnMergeItemsComplete(result)
- {
- if(HandleAleScanError(result, 1014, 1))
- {
- // This means that the user needs to be sent back to
- // PageC to de-select some applications.
- if(PageA.style.display == "")
- PageA.style.display = "none"
- if(PageB.style.display == "")
- PageB.style.display = "none"
- if(PageD.style.display == "")
- PageD.style.display = "none"
-
- PageC.style.display = "";
-
- window.focus();
-
- // Reset the values on the location page.
- locationSelectAll.disabled = false;
- locationSelectNone.disabled = false;
- locationList.Enabled(true);
- locationList.LTable.style.cursor = "";
- // re-enable the items in the list
- var iLocationList = UILocation_GetSelectedLocations();
- var nLocations = iLocationList.ItemCount;
- for(var i = 0; i < nLocations; i++)
- {
- var checkbox = locationList.GetCellPtr(i,0);
- checkbox.disabled = false;
- }
-
- // Reset the buttons.
- FinishBtn.disabled = false;
- NextBtn.disabled = false;
- BackBtn.disabled = false;
- Cancel.disabled = false;
- FixBtnText(false);
- EnableCloseButton(true);
-
- // And the cursor
- AleWiz_Body.style.cursor = "";
- }
- else
- {
- AleWiz_Body.style.cursor = "";
- window.navigate("res://closeme.xyz");
- }
- }
-
- function SetProgress(nPct)
- {
- SetProgressImpl(ProgDone,ProgRemain,pctdone,nPct);
- }
-
- function SetProgressImpl(complete,remaining,text,nPct)
- {
- // We must special case 0 otherwise we get "invalid property"... arrrgggg!
- var nRemain = 100 - nPct;
- text.innerHTML = nPct;
-
- if(nPct > 0)
- {
- complete.style.display = "";
- complete.width = nPct + "%";
- }
- else
- {
- complete.style.display = "none";
- }
-
- if(nRemain > 0)
- {
- remaining.style.display = "";
- remaining.width = nRemain + "%";
- }
- else
- {
- remaining.style.display = "none";
- }
- }
-
- function Elipse_Path(nMaxLen, szPath)
- {
- var szItems = szPath.split("\\");
- var nItem = 0;
- var nLastStart = 1;
- var szOutput = szPath;
- while(szOutput.length > nMaxLen)
- {
- szOutput = szItems[0];
- szOutput = szOutput + "\\" + "...";
-
- for(nItem = nLastStart; nItem < szItems.length; nItem++)
- {
- szOutput = szOutput + "\\" + szItems[nItem];
- }
-
- nLastStart++;
- }
-
- return szOutput;
- }
-
- function CheckUserType()
- {
- var type = UserManager.CurrentUserType;
- var product = UserManager.ProductType;
-
- if((product == "PT_SCF") || (product == "PT_NPF") || (product == "PT_SDF"))
- {
- if(type == "UT_RESTRICTED")
- {
- newAlert(StrID("ALEScanAdministrator"), UserManager.AppTitle, 3, 0, 0, 0);
- window.navigate("res://closeme.xyz");
- }
- }
- else
- {
- if(type != "UT_SUPERVISOR")
- {
- newAlert(StrID("ALEScanSupervisor"), UserManager.AppTitle, 3, 0, 0, 0);
- window.navigate("res://closeme.xyz");
- }
- }
- }
-
- function OnAdd()
- {
- FoundList.Add();
- }
-
- function OnModify()
- {
- FoundList.Modify();
- }
-
- function OnCheckAll()
- {
- FoundList.SelectAll();
- }
-
- function OnUncheckAll()
- {
- FoundList.UnselectAll();
- }
-
- function foundList_OnCheckStateChanged(bAnySelected)
- {
- NextBtn.disabled = !bAnySelected;
- }
-
- function OnKeyDownHandler()
- {
- // Last Control Tab over to the <back, next, close> button.
- var VK_ESCAPE = 27;
-
- if (window.event.keyCode == VK_ESCAPE && !Cancel.disabled)
- {
- // Escape key.. We want to exit out of the wizard..
- window.navigate("res://closeme.xyz");
-
- }
-
- }
-
- function initLocationList()
- {
- // Setup the list control
- locationList.SetTableClass("ListBoxClass");
- locationList.OnClick = locationList_OnClick;
- locationList.OnDblClick = locationList_OnDblClick;
- locationList.OnSpace = locationList_OnSpace;
-
- locationList.DeleteAllRows();
- locationList.SetColumnCount(2);
- locationList.SetColumnWidth(0, "15px");
- locationList.SetColumnWidth(1, "100px");
-
- // populate list
- AleWiz_Body.style.cursor = "wait";
-
- try
- {
- var nLocations = g_iLocationList.ItemCount;
- for (var i=0; i<nLocations; i++)
- {
- var iLocation = g_iLocationList.GetItem(i);
-
- var pRow = locationList.InsertRow(-1);
- var Enabled = "checked=yes";
-
- var checkboxString = "<input type=checkbox " + Enabled + ">";
- locationList.SetCellTextPtr(pRow, 0, checkboxString);
-
- var locationName = iLocation.Name;
- var divID = "";
- if(iLocation.Active)
- {
- locationName += " ";
- locationName += StrID("Active");
- divID = "id='ACTIVE ITEM. DO NOT MOVE THIS STRING OUT OF THE CODE.'"
- }
- var TextToAdd = "<div " + divID + " style='margin-top:6;margin-bottom:6'>" + locationName + "</div>";
- locationList.SetCellTextPtr(pRow, 1, TextToAdd);
- }
- }
- catch(e)
- {
- }
-
- AleWiz_Body.style.cursor = "";
- }
-
- function locationList_OnSpace()
- {
- var nCurSel = locationList.GetCurSel();
- var bEnable = false;
-
- if(nCurSel < 0)
- {
- return;
- }
-
- // Swap the state of the check box for this item
- var CheckBox = locationList.GetCellPtr(nCurSel, 0).children[0];
- CheckBox.checked = !CheckBox.checked;
-
- UILocation_UpdateNextButtonState();
- }
-
- function locationList_OnClick()
- {
- UILocation_UpdateNextButtonState();
- }
-
- function UILocation_UpdateNextButtonState()
- {
- var iLocationList = UILocation_GetSelectedLocations();
-
- if(iLocationList.ItemCount > 0)
- {
- FinishBtn.disabled = false;
- }
- else
- {
- FinishBtn.disabled = true;
- }
- }
-
- function locationList_OnDblClick()
- {
- var nCurSel = locationList.GetCurSel();
- var bEnable = false;
-
- if(nCurSel < 0)
- {
- return;
- }
-
- // Swap the state of the check box for this item
- var CheckBox = locationList.GetCellPtr(nCurSel, 0).children[0];
- CheckBox.checked = !CheckBox.checked;
-
- UILocation_UpdateNextButtonState();
- }
-
- function UILocation_SelectAll()
- {
- for(var i = locationList.GetRowCount(); i > 0; i--)
- {
- var CheckBox = locationList.GetCellPtr(i - 1, 0).children[0];
- CheckBox.checked = true;
- }
- UILocation_UpdateNextButtonState()
- }
-
- function UILocation_DeselectAll()
- {
- for(var i = locationList.GetRowCount(); i > 0; i--)
- {
- var CheckBox = locationList.GetCellPtr(i - 1, 0).children[0];
- CheckBox.checked = false;
- }
- UILocation_UpdateNextButtonState()
- }
-
- function UILocation_GetSelectedLocations()
- {
- var iLocationList = new ActiveXObject("ccFWSettg.LocationList");
-
- for(var i = locationList.GetRowCount(); i > 0; i--)
- {
- var CheckBox = locationList.GetCellPtr(i - 1, 0).children[0];
- var bChecked = CheckBox.checked;
- var div = locationList.GetCellPtr(i-1, 1).children[0];
- var sLocation = div.innerText;
- if(bChecked)
- {
- if(div.id == "ACTIVE ITEM. DO NOT MOVE THIS STRING OUT OF THE CODE.")
- {
- var sTmp = sLocation.slice(0, sLocation.lastIndexOf(StrID("Active")));
- sLocation = sTmp;
- }
- sLocation = trim(sLocation);
- iLocationList.AddItem(g_iLocationList.GetItem(i-1));
- }
- }
- return iLocationList;
- }
-
- function UserManager_OnFREIntegratorStart()
- {
- if(g_bScanStarted)
- StopBtn_OnClick();
-
- window.navigate('res://closeme.xyz');
- }
-
- function EnableCloseButton(bEnabled)
- {
- //turn off webWnd's close button
- var webWnd = window.external.ObjectArg;
- webWnd.CloseButton = bEnabled;
- }